package redisclient

import (
	"fmt"
	"redisconn"

	"github.com/garyburd/redigo/redis"
)

func Set(key string, value string) error {
	// 用完后将连接放回连接池
	defer redisconn.Rc.Close()
	reply, err := redis.Int64((redisconn.Rc.Do("SET", key, value)))
	fmt.Println(reply)
	if err != nil {
		return err
	}
	return nil
}

func Get(key string) (string, error) {
	defer redisconn.Rc.Close()
	reply, err := redis.String(redisconn.Rc.Do("GET", key))
	if err != nil {
		return "", err
	}
	return reply, nil
}
